#ifndef HELICTRLPANEL_H
#define HELICTRLPANEL_H

#include <wx/joystick.h>
#include <wx/log.h>
#include <wx/timer.h>
#include <wx/fileconf.h> 

#include "HeliCtrl_GUI.h"
#include "LPTCtrl.h"

#define TELEMETRY_TIMER_ID 10001
#define TEST_TIMER_ID 10002


class HeliCtrlPanel : public MainPanel
{
public:
	HeliCtrlPanel( wxWindow* parent );
	~HeliCtrlPanel();


protected:
	void FillJoys();
	void RunJoy (int n);
	void FreeJoy ();
	void InitTelemetry();
	void LoadConfig(void);
	void SaveConfig(void);

protected:
	wxJoystick *m_Joystick;
	int m_CurrentJoy;
	wxTimer m_TelemetryTimer;
	wxTimer m_TestTimer;
	wxFileConfig *m_Config;

protected:
	void OnOK( wxCommandEvent& event );
	void OnJoysReload( wxCommandEvent& event );
	void OnJoyChange( wxCommandEvent& event );
	void OnJoystickButtonEvent(int Button, bool Down);
	void OnJoystickEvent(wxJoystickEvent& event);
	wxVertex2D PrescaleToPercentx10(wxPoint &point);
	void OnTelemetryTimer(wxTimerEvent& event);
	void OnTestTimer(wxTimerEvent& event);
	void Connect_ButtonClick( wxCommandEvent& event );
	void Test_ButtonClick( wxCommandEvent& event );
	void OnBeepBtn( wxCommandEvent& event );
	void OnVoltageLimit(wxScrollEvent &event);
	void OnIntegrOffsets(wxScrollEvent &event);
	void OnIntegrReset( wxCommandEvent& event );
private:
	size_t m_TelemEng1,m_TelemEng2;
	size_t m_Telem1Eng1;
	size_t m_Telem2Curv1,m_Telem2Curv2;
	wxPoint m_PrevJoyPos;
	DECLARE_EVENT_TABLE();
};

#endif //HELICTRLPANEL_H
